Skip to content

Fix missing request context (cookies/headers) in WebSocket callbacks#3815

Open
i-murray wants to merge 3 commits into
plotly:devfrom
i-murray:fix/websocket-callback-request-context
Open

Fix missing request context (cookies/headers) in WebSocket callbacks#3815
i-murray wants to merge 3 commits into
plotly:devfrom
i-murray:fix/websocket-callback-request-context

Conversation

@i-murray

@i-murray i-murray commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

Propagate cookies, headers, args, path, remote, and origin from the WebSocket handshake onto the callback context in create_ws_context, mirroring the HTTP path. This fixes auth helpers (e.g. dash_enterprise_auth.get_user_data) failing over the WebSocket transport because callback_context.cookies/headers were empty.

Closes #3814

Contributor Checklist

  • I have run the tests locally and they passed.
  • I have added tests, or extended existing tests, to cover any new features or bugs fixed in this PR

optionals

  • I have added entry in the CHANGELOG.md

Propagate cookies, headers, args, path, remote, and origin from the WebSocket handshake onto the callback context in create_ws_context, mirroring the HTTP path. This fixes auth helpers (e.g. dash_enterprise_auth.get_user_data) failing over the WebSocket transport because callback_context.cookies/headers were empty.
@sonarqubecloud

Copy link
Copy Markdown

@T4rk1n

T4rk1n commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

We have another PR #3819 that uses set_context_request on the fastapi part for the same effect, I think we need both solution consolidated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] WebSocket callbacks do not expose request cookies/headers on callback_context

3 participants